package com.calvin.study.controller;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.calvin.study.service.WebSocketServer;

import cn.hutool.core.date.DateUtil;

@Controller
@RequestMapping("/api/websocket")
public class WebSocketController02 {

	@GetMapping("/start")
	public String start() {
		return "index2";
	}

	@GetMapping("/pushToWeb")
	//@Scheduled(fixedRate = 1000)
	public String pushToWeb() {
		WebSocketServer.sendInfo(DateUtil.now(), "10");
		return "success";
	}

}
